package Demo1;
class Shape{
    public void draw(){
        //System.out.println("画图");     没必要实现，子类重写了     设置成抽象类
    }
}
class Rect extends Shape{
    @Override
    public void draw() {

        System.out.println("画一个矩形");
    }
}
class Flower extends Shape{
    @Override
    public void draw() {
        //super.draw();     默认调用父类的方法
        System.out.println("画一朵花");
    }
}
public class Test {
    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        drawMap(new Rect());
        drawMap(new Flower());
    }
}
